<?php
class site_manageModel extends baseModel{

    //列表
    public function site_list() {
        $list_files=glob(ROOT_PATH.'inc/site/*/config.php');
        $data=array();
        if(!empty($list_files)){
            foreach ($list_files as  $key => $value) {
                $config=require ($value);
                $data[$key]=$config;
                $file_name=explode('/', $value);
                $file_name=array_slice($file_name,-2,1);
                $data[$key]['SITE_MARK']=$file_name[0];
            }
        }
        return $data;
    }

    public function info($mark){
        $config_array=require (ROOT_PATH.'inc/site/'.$mark.'/config.php');
        require (ROOT_PATH.'inc/site/'.$mark.'/db.ini.php');
        $config_array['SITE_MARK']=$mark;
        return array_merge((array)$config_array,(array)$config['DB']);
    }

    public function run_sql($data,$sql_array=array()){
        $model=new cpModel($data);
        foreach($sql_array as $sql)
        {
            if(!@$model->db->query($sql)){
                return false;
            }
        }
        return true;
    }

	
}